version: '3.3'
services:
  db:
    image: postgres:13.4
    volumes:
      - postgres_data:/var/lib/postgresql/data/
    env_file:
      - ./.env

  backend:
    image: niktigerbill/foodgram-project
    restart: always
    volumes:
      - static_value:/code/static/
      - media_value:/code/media/
    depends_on:
      - db
    env_file:
      - ./.env

  frontend:
    image: niktigerbill/foodgram_frontend
    volumes:
      - ../frontend/:/app/result_build/
    depends_on:
      - db

  nginx:
    image: nginx:1.19.3
    ports:
      - "80:80"
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
      - ../frontend/build:/usr/share/nginx/html/
      - ../docs/redoc.html:/usr/share/nginx/html/api/docs/redoc.html
      - ../docs/openapi-schema.yml:/usr/share/nginx/html/api/docs/openapi-schema.yml
      - static_value:/var/html/static/
      - media_value:/var/html/media/
    depends_on:
      - backend

volumes:
  postgres_data:
  static_value:
  media_value:
